package com.atguigu.system.controller;

import com.atguigu.common.result.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author： ekode
 * @Date： 2025/9/11 下午1:46
 * @Describe：
 */
@Api(tags = "用户登陆")
@RestController
@RequestMapping("/admin/system/index")
public class IndexController {

   //login
    @PostMapping("login")
    public Result login(){
        Map<String, Object> map = new HashMap<>();
        map.put("token","admin-token");
        System.out.println("login......");
        return Result.ok(map);
    }


    //info
    /* "code": 20000,
             "data": {
        "roles": [
        "admin"
        ],
        "introduction": "I am a super administrator",
                "avatar": "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
                "name": "Super Admin"
    }*/
    @GetMapping("info")
    public Result info(){
        Map<String, Object> map = new HashMap<>();
        map.put("roles","[admin]");
        map.put("introduction","I am a super administrator");
        map.put("name","Super Admin ekode...");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        System.out.println("info......");
        return Result.ok(map);
    }
    //logout
    @PostMapping("logout")
    public Result logout(){
        System.out.println("logout......");
        return Result.ok();
    }
}
